﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Text;
using IDAL.RF.ATETest;
using Model;

namespace DAL.RF.ATETest
{
    public class Test_Active: BaseRepository_DT<TestInfo> ,ITest_Active 
    {
        #region 静态变量定义部分
        private const string PARM_TEST_ACTIVE_PRODUCTSN = "@ProductSN";
        #endregion

        #region 数据检索部分

        public IList<TestInfo> DebugTest_Active_GetbyProductSN(string productSN)
        {
            SqlParameter Parm = new SqlParameter(PARM_TEST_ACTIVE_PRODUCTSN, SqlDbType.NVarChar, 50);
            Parm.Value = productSN;
            return ExcuteSqlToGetEntities("DebugTest_Active_selectByProductSN", Parm);
        }

        public IList<TestInfo> DebugTest_Active_GetbyDT(DateTime dt1,DateTime dt2)
        {
            SqlParameter[] Parms = GetDTParameters();
            Parms[0].Value = dt1;
            Parms[1].Value = dt2;
            return ExcuteSqlToGetEntities("DebugTest_Active_selectbyDT", Parms);
        }

        //----------------------------以上为调试有源ATE，以下为检测有源ATE-------------------------------------------

        public IList<TestInfo> Test_Active_GetbyProductSN(string productSN)
        {
            SqlParameter Parm = new SqlParameter(PARM_TEST_ACTIVE_PRODUCTSN, SqlDbType.NVarChar, 50);
            Parm.Value = productSN;
            return ExcuteSqlToGetEntities("Test_Active_selectByProductSN", Parm);
        }

        public IList<TestInfo> Test_Active_GetbyDT(DateTime dt1, DateTime dt2)
        {
            SqlParameter[] Parms = GetDTParameters();
            Parms[0].Value = dt1;
            Parms[1].Value = dt2;
            return ExcuteSqlToGetEntities("Test_Active_selectbyDT", Parms);
        }
        #endregion

        #region 参数部分
        #endregion


        #region 重写基类部分
        //-------------------------------------重写超类基础操作---------------------------------------------------------

        public override TestInfo GetEntityRecord(SqlDataReader rdr)
        {
            TestInfo pro = new TestInfo(rdr.GetGuid(0), rdr.GetValue(1).ToString(), rdr.GetDateTime(2), rdr.GetValue(3).ToString(), rdr.GetValue(4).ToString(), rdr.GetValue(5).ToString(), rdr.GetValue(6).ToString(), rdr.GetValue(7).ToString(), rdr.GetValue(8).ToString());
            return pro;
        }
        #endregion
    }
}
